<!DOCTYPE html>
<html>
<head>
    <title>JS Test</title>
    <script>
        console.log('测试开始');
        
        // 模拟加载trim.js中的函数
        function testFunction() {
            console.log('测试函数执行');
            
            // 测试对象处理
            const testData = {
                "Battery": [{"spec_name": "Battery Capacity", "spec_value": "43", "spec_unit": "kWh"}],
                "Engine": [{"spec_name": "Power", "spec_value": "200", "spec_unit": "hp"}]
            };
            
            console.log('测试数据:', testData);
            
            // 测试renderCategoryArraySpecs逻辑
            const result = Object.entries(testData)
                .filter(([categoryName, items]) => Array.isArray(items) && items.length > 0)
                .map(([categoryName, items]) => {
                    return `分类: ${categoryName}, 项目数: ${items.length}`;
                }).join('; ');
                
            console.log('处理结果:', result);
            document.body.innerHTML = '<h3>JavaScript测试结果:</h3><p>' + result + '</p>';
        }
        
        window.onload = testFunction;
    </script>
</head>
<body>
    <p>加载中...</p>
</body>
</html>
